//Member Templates
Member function of classes maybe templates.However,member  templates may not be 
virtual ,For example
class Myclass
{
	...
	template<typename  T>
	void f(T);
};

Myclass::f declares a set of member functions for parameters of any type.
You can pass any arguments as long as its type provides all operations used by f();

This feature is often used to support automatically type convertions for members in 
class templates;

For example , in the following define:

the arguments x of assign()  must have exactly the same type as the object it is called for.
template<typename T>
class MyClass
{
	private:
		T value;
	public:
		void assign(const MyClass<T>& x){//x must have the same type as *this.
			value = x.value;
		}
		....
};


IT would be an error to use diff template typef for the object assign() operation.
even if an automatically type convertions from one type to the other is provided.


void f()
{
	MyClass<double> d;
	MyClass<int> i;
	d.assign(d);//ok 
	d.assign(i);//ERROR:  i is MyClass<int>
						//but MyClass<double> is required
}

by provided a different template type for member function , you relax the rule of exact match.
the member 	function template arguments may have any template type.then as long as
the types are assignable 
template<typename T>
class MyClass
{
	private:
		T value;
	public:
		template<typename X>                       //member templates
		void assign(const MyClass<X>& x)    //allow different template types
		{
			value = x.getValue();
		}
		
		T getValue() const {
			return value.
		}
		....
};

void f()
{
	MyClass<double> d;
	MyClass<int> i;
	d.assign(d);//OK
	d.assign(i);//OK int is assignable to double .
}



//Default Template parameters
//KEYWORD typename
//
// template <typename T>
// class Myclass
// {
	// ...
	// typename T::SubType *ptr;
	// ...
// };

// typename is used to clarify that SubType is a type defind within class T.Thus ,ptr,is a 
// pointer to the type T::SubType .Without typename ,SubType would be considered a static
// member,thus is 
	// T::SubType (*) ptr;
// Would be a multiplication of value SubType of type T with ptr.

// SubType being a type, any type that is used in place of T must provider an inner type SubType.
// the use of type Q as a template arguments is possible only if type Q has an inner type 
// definition for SubType.

// ///////some technicial///////////
// class Q
// {
	// typedef int SubType;
	// ...
// };

// Myclass<Q> x ;// OK

// the ptr member of Myclass<Q> would be a pointer to type int.
// However ,the subtype could also be an abstract data type, such  as a class.

// class Q
// {
	// class SubType;
// };

// //note:
// typename is always necessary  to qualify an identifier of a template as being a type.
// even if interpretation  that is not  a type would make no sense. 


// Thus,  any identifier of a template is considered to be a value except if it is qualified 
// by typename.

// typename can also be used instead of class in a template declaration .

// template <typename T> class MyClass;



// template <typename T, typename container = vector<T>>
// class MyClass;
//If  only pass one argument, the default parameter is used as the second arguments.
// MyClass<int> x1; //is equivalent  to MyClass<int vector<int>> x1;



// nonetype template parameters 
// class bitset<> ,pass the number of bits are template argument 
// the following statements define two bitfields :one with 10 bits and one with 33bits.
// bitset<10> flag10;//bitset with 10 bits.
// bitset<33> flag33;//bitset with 33 bits.
// can't compare them unless corresopnding type convertions is provided .

// NEW fundamental Data Types
// char16_t char32_t 
// long long and unsigned long long 
// std::nullptr_t 




// scoped Enumerations
// Implicit convertions to and from int are not possible .
// Values like mr are not part of this scope where the enumeration is declared.
// use like this , [Salution::mr instead].
// :char  int is default.
// enum class Salution : char  //specify keyword class behind enum.
// {
	// mr,
	// ms,
	// co,
	// none
// };

// keyword decltype
// example:
// std::map<std::string ,std::string > coll;
// decltype(coll)::value_type elem;

// template<typename T1, typename T2>
// decltype(x+y) add(T1 x, T2 y)

// C++11 
// template <typename T1, typename T2>
// auto add(T1 x,T2 y) -> decltype(x+y)



// //Type of lambdas
// data: 2025/08/06 22:17
// The type of  a lambdas is an anonymous function object of functor  that is unique for each lambda 
// expressions 
// #include<iostream>
// #include<functional>

// std::function<int(int ,int )> returnLambda ()
// {
	// return [] (int x, int y){
		// return x*y;
	// };
// }


// int main()
// {
	// auto LmbF = returnLambda();
	// std::cout<<"LmbF(5,7) = "<<LmbF(5,7)<<std::endl;
	// return 0;
// }

// LmbF(5,7) = 35


//definition of main()

int main()
{
	....
}

and 
int main(int grgc, char * argv[])
{
	...
}
where argv the array of command-line arguments might also be defined as char**.
note that the retuen type int is required.

unlike C,C++ defined an imolicit 
	return 0;
at the end of main() 
